<?php

class Public_Post_DeleteSuccessView extends BlogPublicBaseView
{
	public function executeHtml(AgaviRequestDataHolder $rd)
	{
		if (!is_null($this->getAttribute('ok'))) {
		    // redirect back to the list
		    $this->setRoutingRedirect('root');
		    return;
		}
	    
		// display confirmation form
		$post_id = $rd->getParameter('post_id');
		$ro = $this->getContext()->getRouting();
		/* @var $model Public_PostsModel */
		$model = $this->getContext()->getModel('Posts', 'Public');
		$post = $model->getPost($post_id);
		
		$this->setupHtml($rd, 'blog');
		
		$this->setAttribute('title', 'Delete post');
		$this->setAttribute('post_title', MarkupProcessor::getPostTitleHtml($post));
		$this->setAttribute('submit_route', $ro->gen('post_by_id.delete', array('post_id'=>$post_id)));
	}
}

?>
